import request from 'src/api/request';

export default {
    /**
     * 登陆 oauth2 密码模式
     * http://localhost:8070/sj/oauth/token?username=x&password=123456&grant_type=password&scope=server&client_id=ui&client_secret=metrix
     * @param username
     * @param password
     */
    login(username, password) {
        return request({
            url: '/oauth/token?grant_type=password&scope=client&client_id=ui&client_secret=metrix',
            method: 'POST',
            params: {
                username,
                password
            }
        });
    },
    logout() {
        return request({
            url: '/logout',
            method: 'POST'
        });
    },
    /**
     * 获取用户信息
     */
    getUserInfo() {
        return request({
            url: '/auth/users/info',
            method: 'GET'
        });
    }
};

